% !TEX encoding = UTF-8 Unicode
\documentclass[11 pt, a4paper,titlepage]{report}
%\documentclass[11pt, oneside]{memoir}   
\usepackage[margin=0.9in]{geometry}             

\RequirePackage{fix-cm}
\RequirePackage{titlesec}
\RequirePackage{titletoc}  

%% --------------- Load packages for large documents. ------------------
%% Hyperref is used to setup the hyperlinking between 
%% chapter/section/subsection and contents, citing and references,
%% and footnotes. \widowpenalty and \clubpenalty are used to suppress
%% WINDOWS (the last line of a paragraph typed as the first line of a 
%% new page) and ORPHANS (the first line of a paragraph as the last
%% line of a page).
\usepackage{chapterbib}
% For Bib by Chapter, bibtex the .aux file for each chapter after latex of main
%\usepackage{cite}%                %conflicting with hyperref
\usepackage[colorlinks,%
linkcolor=black,%
anchorcolor=black,%
citecolor=black]{hyperref}%         %setup hyderlinking
\widowpenalty=10000%
\clubpenalty=10000%                % suppress widows and orphans



%\renewcommand{\chaptername}{Chapter}
\titleformat{\chapter}[display]%
  {\bfseries\fontsize{16pt}{19.2pt}\selectfont}
  {\chaptertitlename\ \thechapter}{\baselineskip}{}
\titleformat{\section}[hang]%
  {\bfseries\fontsize{14pt}{16.8pt}\selectfont}
  {\thesection}{\baselineskip}{}
\titleformat{\subsection}[hang]%
  {\bfseries\fontsize{12pt}{14.4pt}\selectfont}
  {\thesubsection}{\baselineskip}{}
  
  
\usepackage{array}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{caption}

\usepackage{rotating}
\usepackage{chapterbib}
\usepackage{graphicx}	
\usepackage{ctable}
\usepackage{multirow}
\usepackage[normalsize]{subfigure} 										
	

%% This is for the code segments of manual!!
\usepackage{color}
\usepackage{listings}
\lstdefinestyle{ MyBash}{language=bash,                % choose the language of the code
basicstyle=\footnotesize,       % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
stepnumber=1,                   % the step between two line-numbers. If it is 1 each line will be numbered
numbersep=5pt,                  % how far the line-numbers are from the code
backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
showspaces=false,               % show spaces adding particular underscores
showstringspaces=false,
commentstyle=\color{red},
keywordstyle=\color{blue},
showtabs=false,                 % show tabs within strings adding particular underscores
frame=single,           % adds a frame around the code
tabsize=2,          % sets default tabsize to 2 spaces
captionpos=b,           % sets the caption-position to bottom
breaklines=true,        % sets automatic line breaking
breakatwhitespace=false,    % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)}          % if you want to add a comment within your code
}

\lstdefinestyle{MyCpp}{ language=C++,                % choose the language of the code
basicstyle=\footnotesize,       % the size of the fonts that are used for the code
numbers=left,                   % where to put the line-numbers
numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
stepnumber=1,                   % the step between two line-numbers. If it is 1 each line will be numbered
numbersep=5pt,                  % how far the line-numbers are from the code
backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
showspaces=false,               % show spaces adding particular underscores
showstringspaces=false,
basicstyle=\ttfamily,
keywordstyle=\color{blue}\ttfamily,
stringstyle=\color{red}\ttfamily,
commentstyle=\color{green}\ttfamily,
morecomment=[l][\color{magenta}]{\#},
showtabs=false,                 % show tabs within strings adding particular underscores
frame=single,           % adds a frame around the code
tabsize=2,          % sets default tabsize to 2 spaces
captionpos=b,           % sets the caption-position to bottom
breaklines=true,        % sets automatic line breaking
breakatwhitespace=false,    % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)}          % if you want to add a comment within your code
}


\usepackage{fancyhdr}

%\setlength{\droptitle}{-5em}   % This is your set screw
\usepackage[parfill]{parskip}
\setlength{\parskip}{1pt}
\setlength{\parsep}{1pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}

\graphicspath{ {./figures/} }

\pagestyle{fancy}
\fancyhf{}
\fancyhead[R]{ PB-[S]AM manual}
\fancyfoot[R]{\thepage\ }



\renewcommand\contentsname{Table of Contents}



\newcommand{\param}[1]{$\textless\texttt{#1}\textgreater$}
\newcommand\T{\rule{0pt}{3.0ex}}       % Top strut
\newcommand\B{\rule[-2ex]{0pt}{0pt}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\include{chapters/titlepg}
\include{chapters/frontmatter}

\tableofcontents

\pagenumbering{arabic}
\setcounter{page}{1}

\include{chapters/intro}
\include{chapters/pbam}
\include{chapters/pbsam}
\include{chapters/analysis}
\include{chapters/errors}

\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{jacs}
\bibliography{pbsam}


\end{document}

